package com.act.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import com.act.dao.IBilltrackDao;
import com.act.domain.Billtrack;
import com.act.dto.PagerDTO;
import com.act.service.api.IBilltrackService;
import com.act.vo.PagerVo;

/**
* @Desccription:类说明
* @Author: 刘承军
* @E-mail:923050345@qq.com
* @Date:2017年11月9日 下午3:53:27  
*/

@Service
public class BilltrackServiceImpl implements IBilltrackService{
	
	@Resource
	private IBilltrackDao billtrackDao;

	@Override
	public void add(Billtrack billtrack) {
		billtrackDao.add(billtrack);
	}

	@Override
	public void update(Billtrack billtrack) {
		billtrackDao.update(billtrack);
	}

	@Override
	public void delete(int id) {
		billtrackDao.delete(id);
	}

	@Override
	public PagerVo<Map> getAll(@Param("pagerDTO")PagerDTO pagerDTO) {
		int startIndex = pagerDTO.getStartIndex();
		int endIndex = pagerDTO.getEndIndex();
		int totalCounts = billtrackDao.getCounts();
		List<Map> list = billtrackDao.getAll(startIndex, endIndex);
		PagerVo<Map> pagerVo = new PagerVo<>(pagerDTO.getPageIndex(),pagerDTO.getPageSize(),totalCounts,list);

		return pagerVo;
	}

	@Override
	public Billtrack getById(@Param("id")int id) {
		return billtrackDao.getById(id);
	}

}
